package com.example.hehecat.yuejian1.mvp.model;


import com.example.hehecat.yuejian1.http.RetrofitHttp;
import com.example.hehecat.yuejian1.mvp.contract.ActivityReplyContract;
import com.example.hehecat.yuejian1.mvp.model.bean.ReplyBean;
import com.example.hehecat.yuejian1.mvp.model.bean.SuccessBean;

import java.util.List;

import okhttp3.OkHttpClient;
import rx.Subscriber;
import rx.android.schedulers.AndroidSchedulers;
import rx.schedulers.Schedulers;

public class ActivityReplyModel implements ActivityReplyContract.Model {

    @Override
    public void getAllReplyData(int activity_id, Subscriber<List<ReplyBean>> subscriber) {
        OkHttpClient.Builder builder = new OkHttpClient.Builder();
        RetrofitHttp.getRetrofit(builder).getActivityReply(activity_id)
                .subscribeOn(Schedulers.newThread())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(subscriber);
    }

    @Override
    public void replyActivity(int activity_id, int user_id, String comment, Subscriber<SuccessBean> subscriber) {
        OkHttpClient.Builder builder = new OkHttpClient.Builder();
        RetrofitHttp.getRetrofit(builder).replySctivity(activity_id,user_id,comment)
                .subscribeOn(Schedulers.newThread())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(subscriber);
    }
}
